package com.zhuss.controller.opus;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.opus.invit.CreamInvitBo;
import com.zhuss.bean.bo.opus.invit.CreateInvitBo;
import com.zhuss.bean.bo.opus.invit.DeleteInvitBo;
import com.zhuss.bean.bo.opus.invit.UpdateInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.CollectInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.DelTopicInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.ForwardInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.RecommendInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.ThumbInvitBo;
import com.zhuss.bean.bo.opus.invit.wechat.TopicInvitBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.enums.CreamType;
import com.zhuss.exception.WpsException;
import com.zhuss.opus.invit.InvitOperateServiceExt;


/**
 * invit操作 controller
 * @Author zhushanshuo
   @Date 2020-02-04 22:58
 *
 */
  
 
@RestController
@RequestMapping("/invit")
public class InvitOperateController extends BaseController {
	
	@Autowired
	@Qualifier("invitOperateService")
	private OperateService<Void, Object> invitOperateService;
	
	@Autowired
	@Qualifier("invitOperateServiceExt")
	private InvitOperateServiceExt invitOperateServiceExt;
	
	/**
	 * 创建
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateInvitBo bo) throws WpsException {
		
		invitOperateService.create(bo);
    }
	
	
	/**
	 * 修改
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateInvitBo bo) throws WpsException {
		
		invitOperateService.update(bo);
    }
	
	/**
	 * 删除
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteInvitBo bo) throws WpsException {
		
		invitOperateService.delete(bo);
    }
	
	/**
	 * 点赞
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/thumb")
	public void thumb(@RequestBody ThumbInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.thumb(bo);
	}
	
	
	/**
	 * 收藏
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/collect")
	public void collect(@RequestBody CollectInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.collect(bo);
	}
	
	/**
	 * 转发
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/forward")
	public void forward(@RequestBody ForwardInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.forward(bo);
	}
	
	/**
	 * 推荐
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/recommend")
	public void recommend(@RequestBody RecommendInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.recommend(bo);
	}
	
	/**
	 * 取消
	 * 点赞
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/delThumb")
	public void delThumb(@RequestBody ThumbInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.delThumb(bo);
	}
	
	
	/**
	 * 取消
	 * 收藏
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/delCollect")
	public void delCollect(@RequestBody CollectInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.delCollect(bo);
	}
	
	/**
	 * 取消
	 * 转发
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/delForward")
	public void delForward(@RequestBody ForwardInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.delForward(bo);
	}
	
	/**
	 * 取消
	 * 推荐
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/delRecommend")
	public void delRecommend(@RequestBody RecommendInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.delRecommend(bo);
	}
	
	
	/**
	 * 评论
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/topic")
	public void topic(@RequestBody TopicInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.topic(bo);
	}
	
	/**
	 * 删
	 * 评论
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/delTopic")
	public void delTopic(@RequestBody DelTopicInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.delTopic(bo);
	}
	
	/**
	 * 优选
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/cream")
	public void cream(@RequestBody CreamInvitBo bo) throws WpsException {
		
		invitOperateServiceExt.cream(bo);
	}
	
	/**
	 * 取消
	 * 优选
	 * @param bo
	 * @throws WpsException
	 */
	@ResponseBody
	@PostMapping("/delCream")
	public void delCream(@RequestBody CreamInvitBo bo) throws WpsException {
		
		bo.setCream(CreamType.普通.key());
		invitOperateServiceExt.cream(bo);
	}
	
}
